import { queryDictByType, queryAppSystemOptions, queryMpAbilityOptions, queryMpServiceOptions, queryMpOrgOptions } from '@/api/search/searchOptions';

// 查询系统选项
export function systemOptions() {
	return new Promise((resolve, reject) => {
		queryAppSystemOptions().then((res) => {
			resolve(res.data);
		});
	});
}

// 所属能力选项
export function mpAbilityOptions() {
	return new Promise((resolve, reject) => {
		queryMpAbilityOptions().then((res) => {
			resolve(res.data);
		});
	});
}

// 所属服务选项
export function mpServiceOptions(id: string | number = 0) {
	return new Promise((resolve, reject) => {
		queryMpServiceOptions(id).then((res) => {
			resolve(res.data);
		});
	});
}

// 所属单位(内部)选项
export function mpOrgOptions() {
	return new Promise((resolve, reject) => {
		queryMpOrgOptions().then((res) => {
			resolve(res.data);
		});
	});
}

// 所属中台选项
export function middlePlatformOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_type').then((res) => {
			resolve(res.data);
		});
	});
}

// 能力输出模式选项
export function outputModeOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_output_mode').then((res) => {
			resolve(res.data);
		});
	});
}

// 能力识别策略选项
export function recognitionStrategyOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_recognition_strategy').then((res) => {
			resolve(res.data);
		});
	});
}

// 能力状态选项
export function abilityStatus() {
	return new Promise((resolve, reject) => {
		resolve([
			{ label: '已发布', value: 1 },
			{ label: '已下架', value: 2 },
		]);
	});
}

// 服务调用方式选项
export function serviceInvocationOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_service_invocation').then((res) => {
			resolve(res.data);
		});
	});
}

// 单位类型选项
export function orgTypeOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_org_type').then((res) => {
			resolve(res.data);
		});
	});
}

// 告警等级选项
export function alarmLevelOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('alarm_level').then((res) => {
			resolve(res.data);
		});
	});
}

// 资源类型选项
export function resourceTypeOptions() {
	return new Promise((resolve, reject) => {
		resolve([
			{ label: '普通接口', value: 1 },
			{ label: '登录接口', value: 2 },
			{ label: '普通页面', value: 3 },
			{ label: '核心页面', value: 4 },
		]);
	});
}

// 返回码类型选项
export function returnCodeTypeOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_return_code_type').then((res) => {
			resolve(res.data);
		});
	});
}

// 返回码状态选项
export function returnCodeStatusOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_return_code_status').then((res) => {
			resolve(res.data);
		});
	});
}

// 子订单类型选项
export function suborderTypeOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_suborder_type').then((res) => {
			resolve(res.data);
		});
	});
}

// 子订单状态选项
export function suborderStatusOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_suborder_status').then((res) => {
			resolve(res.data);
		});
	});
}

// 服务开通结果选项
export function serviceGrantResultOptions() {
	return new Promise((resolve, reject) => {
		queryDictByType('mp_service_grant_result').then((res) => {
			resolve(res.data);
		});
	});
}
